//
//  ViewController.m
//  ConectSounds
//
//  Created by 李钰 on 2017/9/19.
//  Copyright © 2017年 tianhuangyule. All rights reserved.
//

#import "ViewController.h"
#import "AVTools.h"
#import "NSThread+Extend.h"
@interface ViewController ()

@end

@implementation ViewController
{
    NSInteger count;
    dispatch_queue_t _serialQueue;
    UITextField * textfield;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    textfield = [[UITextField alloc] initWithFrame: CGRectMake(50, 100, 200, 40)];
    [self.view addSubview: textfield];
    textfield.placeholder = @"输入金额";
    textfield.keyboardType = UIKeyboardTypeNumberPad;
    textfield.backgroundColor = [UIColor yellowColor];
    
    UIButton * btn = [[UIButton alloc] initWithFrame: CGRectMake(100, 250, 100, 100)];
    btn.backgroundColor = [UIColor redColor];
    [btn addTarget: self action: @selector(onBtn) forControlEvents: UIControlEventTouchUpInside];
    [btn setTitle: @"播放" forState: UIControlStateNormal];
    [self.view addSubview: btn];
    count = 0;
//    _serialQueue = dispatch_queue_create("com.lysongzi.serial", DISPATCH_QUEUE_SERIAL);
}

- (void)onBtn
{

[[AVTools sharedInstance] playSoundsWithString: [NSString stringWithFormat: @"收银成功%@元",textfield.text]];
    return;
    NSArray * arr = @[@"收银成功0.01元",@"收银成功10元",@"收银成功100元",@"收银成功1000元",@"收银成功10000元",@"收银成功100000元",@"收银成功1元",@"收银成功11元",@"收银成功111元",@"收银成功1111元",@"收银成功11111元",@"收银成功1.1元",@"收银成功11.1元",@"收银成功111.1元",@"收银成功1111.1元",@"收银成功11111.1元",@"收银成功101001元",@"收银成功100001元",@"收银成功110101元"];
    [[AVTools sharedInstance] playSoundsWithString: arr[count] ];
    count ++;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
